package com.jd.threed.生产者消费者原理;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Consumer {

    BlockingQueue storage;

    public Consumer(BlockingQueue storage) {
        this.storage = storage;
    }

    public boolean nededMoreNums() {
        if (Math.random() > 0.97) {
            return false;
        }
        return true;

    }

    public static void main(String[] args) {
        ArrayBlockingQueue queue = new ArrayBlockingQueue<>(2);
        try {
            queue.put(1);
            queue.put(2);
            queue.put(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
